const express = require('express');
const router = express.Router();

const {get, all} = require('../utils/http')

/* GET users listing. */
router.get('/all', async (req, res, next) => {
  let java = await get({
    url: 'https://api.apiopen.top/getJoke?page=1&count=2&type=video'
  })
  let node = get({
    url: 'https://api.apiopen.top/getSingleJoke?sid=28654780'
  })
  let php = get({
    url: 'https://api.apiopen.top/singlePoetry'
  })

  let alldata = await all([node, php])
  // console.log(alldata)
  res.json({
    java,
    nodeAndphp: alldata
  })
  // res.send('respond with a resource');
});

module.exports = router;
